#ifndef _APPEARANCE_BASE_HH
#define _APPEARANCE_BASE_HH

#include <stdio.h>
#include <time.h>

#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>

#include <vector>
#include <stdlib.h>
#include <algorithm>
#include <iostream>
#include <fstream>

#include <stdexcept>

#include <cxcore.h>
#include <cv.h>
#include <highgui.h>

#include <boost/smart_ptr.hpp>

#include "basic_utils.hh"


class AppearanceBase{
public:

    AppearanceBase()
    {nvectors = 0; vector_as_row = false;}   


    int save(const char *file);
    //vector_as_row: convert the mean and vector to 1xN vectors, to be
    //used in cvProjectPCA and cvBackProjectPCA.
    int load(const char *file, bool vector_as_row = false);

    //use this and not vectors.size() or similar.
    unsigned int nvectors;
    CvSize sz;
    bool vector_as_row;

    boost::shared_ptr<IplImage> mean;
    std::vector<boost::shared_ptr<IplImage> > vectors;
    boost::shared_ptr<CvMat> eigvals;


    void clear(){vectors.clear(); mean.reset(), eigvals.reset();}
    

};


#endif
